package com.song.dao;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.song.po.Permission;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PermissionDao extends BaseMapper<Permission> {


   @Select("select * from role_permission rp" +
       " inner join t_role role on role.role_id = rp.role_id" +
       " inner join t_permission permission on permission.permission_id = rp.permission_id" +
       " ${ew.customSqlSegment}" +
       " order by permission.group_id")
   @ResultMap("com.song.dao.PermissionDao.permissionMap")
   List<Permission> getPermissionList(@Param(Constants.WRAPPER)QueryWrapper<Permission> queryWrapper2);
}
